﻿package mortal.game.view.palyer.view
{
    import Message.DB.Tables.*;
    import Message.Game.*;
    import Message.Public.*;
    import baseEngine.modifiers.*;
    import com.gengine.core.frame.*;
    import com.mui.controls.*;
    import com.mui.utils.*;
    import extend.language.*;
    import fl.data.*;
    import flash.display.*;
    import flash.events.*;
    import flash.geom.*;
    import frEngine.effectEditTool.temple.*;
    import frEngine.pools.*;
    import frEngine.primitives.object2d.*;
    import mortal.common.global.*;
    import mortal.component.gconst.*;
    import mortal.component.window.*;
    import mortal.game.cache.*;
    import mortal.game.manager.*;
    import mortal.game.manager.window3d.*;
    import mortal.game.model.*;
    import mortal.game.resource.*;
    import mortal.game.resource.info.item.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.game.scene3D.map3D.util.*;
    import mortal.game.scene3D.model.data.*;
    import mortal.game.scene3D.model.player.*;
    import mortal.game.scene3D.model.player.weapon.*;
    import mortal.game.scene3D.model.pools.*;
    import mortal.game.scene3D.player.entity.*;
    import mortal.game.scene3D.player.type.*;
    import mortal.game.utils.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.item.*;
    import mortal.game.view.copy.treasureHunt.renderer.*;
    import mortal.game.view.palyer.data.*;
    import mortal.game.view.rebate.data.*;
    import mortal.mvc.interfaces.*;

    public class ChargeActivityWin extends BaseWindow
    {
        private var _bg:GImageBitmap;
        private var _levelNum:GImageBitmap;
        private var _levelName:GTextFiled;
        private var _itemList:GTileList;
        private var _gotoChargeBtn:GLoadingButton;
        private var _propItem:BaseItem;
        private var _chargeLittleBtn:GLoadingButton;
        private var _leftTime:SecTimerBitmapView;
        protected var _frameTimer:FrameTimer;
        protected var _rect3d:Rect3DObject;
        protected var _img2d:Img2D;
        protected var _bodyPlayer:ActionPlayer;
        protected var _roleModelPlayer:UserModelPlayer;
        protected var _weaponPlayer:WeaponPlayer;
        protected var _weaponEffectPlayer:EffectPlayer;
        protected var _fightSoulModelPlayer:ActionPlayer;
        protected var _fightSoulEffectPlayer:EffectPlayer;
        private var _data:ChargeActivityData;
        private var _turnNum:Number = 0;
        private static var _instance:ChargeActivityWin;

        public function ChargeActivityWin(param1:ILayer = null)
        {
            super(param1);
            setSize(301 - 4, 580);
            title = Language.getString(41275);
            this.layer = LayerManager.windowLayer3D;
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            isForbidenDrag = true;
            super.createDisposedChildrenImpl();
            this._bg = UIFactory.gImageBitmap("", 0, 0, null, this.onBgLoadCompl);
            this.createChildren();
            return;
        }// end function

        private function createChildren() : void
        {
            this.pushUIToDisposeVec(UIFactory.gImageBitmap(ImagesConst.SystemLevelBg, 229, 147, this.contentTopOf3DSprite));
            this.pushUIToDisposeVec(UIFactory.gImageBitmap(ImagesConst.ChargeActivityTimeBg, 10, 134, this.contentTopOf3DSprite));
            this.pushUIToDisposeVec(UIFactory.gImageBitmap(ImagesConst.ChargeActivityTxt_1, 20, 155, this.contentTopOf3DSprite));
            this._levelNum = UIFactory.gImageBitmap(ImagesConst.SystemLevel_3, 223, 165, this.contentTopOf3DSprite);
            this._levelName = UIFactory.gTextField("", 248, 220, 30, 188, this.contentTopOf3DSprite, GlobalStyle.textFormatBai.setSize(21));
            this._levelName.multiline = true;
            this._levelName.wordWrap = true;
            this._levelName.textColor = 16775623;
            this._itemList = UIFactory.tileList(65, 342 - 29 + 175, 275, 45, this.contentTopOf3DSprite);
            this._itemList.columnWidth = 44;
            this._itemList.rowHeight = 43;
            this._itemList.horizontalGap = 0;
            this._itemList.verticalGap = 0;
            this._itemList.setStyle("skin", new Bitmap());
            this._itemList.setStyle("cellRenderer", TreasureRewardItemCellRenderer);
            this._gotoChargeBtn = UIFactory.gLoadingButton(ResFileConst.GoToChargeBtn, 88, 536, 125, 44, this.contentTopOf3DSprite);
            this._gotoChargeBtn.configEventListener(MouseEvent.CLICK, this.onClickHandler);
            this._gotoChargeBtn.visible = false;
            this._propItem = UICompomentPool.getUICompoment(BaseItem);
            this._propItem.setItemStyle(ItemStyleConst.Small, ImagesConst.FashionEquipBg, 9, 9);
            this._propItem.x = 221;
            this._propItem.y = 441;
            this._propItem.isDragAble = false;
            this._propItem.isShowColorBg = false;
            this.contentTopOf3DSprite.addChild(this._propItem);
            this._propItem.visible = false;
            this._chargeLittleBtn = UIFactory.gLoadingButton(ResFileConst.ChargeLittleBtn, 58, 518, 187, 44, this.contentTopOf3DSprite);
            this._chargeLittleBtn.configEventListener(MouseEvent.CLICK, this.onClickHandler);
            this._chargeLittleBtn.visible = false;
            this._leftTime = UIFactory.secTimerBitmapView(20, 159, "rechargeActivityTimeNumber.png", 11, 15, -2, this.contentTopOf3DSprite, 10);
            this._leftTime.customCharIndex = {0:0, 1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8, 9:9, ::10};
            this._leftTime.setParse("hh:mm");
            return;
        }// end function

        protected function onBgLoadCompl() : void
        {
            if (isDisposed)
            {
                return;
            }
            this.init3DRect();
            this.add3dBg();
            this.initModel();
            return;
        }// end function

        protected function init3DRect() : void
        {
            if (this._rect3d == null)
            {
                this._rect3d = Rect3DManager.instance.registerWindow(true, new Rectangle(11, 38, 281, 547), this);
                Rect3DManager.instance.windowShowHander(null, this);
            }
            return;
        }// end function

        private function add3dBg() : void
        {
            if (this._rect3d)
            {
                this._rect3d.removeImg(this._img2d);
                this._img2d = new Img2D(null, this._bg.bitmapData, new Rectangle(0, 0, 281, 547), false);
                this._rect3d.addImg(this._img2d);
            }
            return;
        }// end function

        protected function initModel() : void
        {
            var _loc_1:TModel = null;
            var _loc_2:String = null;
            var _loc_3:String = null;
            var _loc_4:EntityModelInfo = null;
            if (this._rect3d)
            {
                if (this._data.tmount.type == EAdvanceComponentType._EAdvanceComponentTypeMount)
                {
                    _loc_1 = ModelConfig.instance.getInfoByCode(this._data.tmount.modelId);
                    _loc_2 = _loc_1.mesh1 + ".md5mesh";
                    _loc_3 = _loc_1.bone1 + ".skeleton";
                    if (this._bodyPlayer == null)
                    {
                        this._bodyPlayer = FrObjectPool.getObject(ActionPlayer, this);
                    }
                    this._bodyPlayer.load(_loc_2, _loc_3, _loc_1.texture1);
                    this._bodyPlayer.changeAction(ActionName.MountStand);
                    this._bodyPlayer.play();
                    this._bodyPlayer.scaleValue = 1;
                    this._bodyPlayer.rotationY = 50;
                    this._bodyPlayer.alpha = 1;
                    this._rect3d.addObject3d(this._bodyPlayer, 73 + 72 + 8, 133 + 223 + 15);
                }
                else if (this._data.tmount.type == EAdvanceComponentType._EAdvanceComponentTypePet)
                {
                    _loc_4 = PetUtil.getPetModel(1, this._data.tmount.modelId);
                    _loc_2 = _loc_4.mesh + ".md5mesh";
                    _loc_3 = _loc_4.bone + ".skeleton";
                    if (this._bodyPlayer && this._bodyPlayer.meshUrl == _loc_2 && this._bodyPlayer.animUrl == _loc_3)
                    {
                        return;
                    }
                    if (this._bodyPlayer == null)
                    {
                        this._bodyPlayer = FrObjectPool.getObject(ActionPlayer, this);
                    }
                    this._bodyPlayer.changeAction(ActionName.Stand);
                    this._bodyPlayer.hangBoneName = BoneConst.MountHangModelBone;
                    this._bodyPlayer.selectEnabled = true;
                    this._bodyPlayer.play();
                    this._bodyPlayer.setRotation(0, 0, 0);
                    this._bodyPlayer.scaleValue = 2;
                    this._bodyPlayer.load(_loc_2, _loc_3, _loc_4.texture, this._rect3d.renderList);
                    this._rect3d.addObject3d(this._bodyPlayer, 170 - 33, 360);
                    PetSelfEffectUtil.addSelfEffect(this._bodyPlayer, _loc_4.effect, this._rect3d.renderList);
                }
                if (this._data.tmount.type == EAdvanceComponentType._EAdvanceComponentTypeClothes || this._data.tmount.type == EAdvanceComponentType._EAdvanceComponentTypeWing)
                {
                    this.updateClothWingModel(this._data.tmount.type);
                }
                if (this._data.tmount.type == EAdvanceComponentType._EAdvanceComponentTypeWeapon)
                {
                    this.updateWeaponModel();
                }
                if (this._data.tmount.type == EAdvanceComponentType._EAdvanceComponentTypeFightSoul || this._data.tmount.type == EAdvanceComponentType._EAdvanceComponentTypeFightMethod || this._data.tmount.type == EAdvanceComponentType._EAdvanceComponentTypeDragonSoul || this._data.tmount.type == EAdvanceComponentType._EAdvanceComponentTypeHolyBook || this._data.tmount.type == EAdvanceComponentType._EAdvanceComponentTypeWarShield || this._data.tmount.type == EAdvanceComponentType._EAdvanceComponentTypeMonsterSoul)
                {
                    this.updateFightSoulModel();
                }
            }
            return;
        }// end function

        protected function initRoleModel() : void
        {
            this._roleModelPlayer = FrObjectPool.getObject(UserModelPlayer, this);
            var _loc_1:* = Cache.instance.role.entityInfo.career;
            var _loc_2:* = Cache.instance.role.entityInfo.sex;
            var _loc_3:* = Cache.instance.role.roleEntityInfo.clothes;
            if (GameMapUtil.curMapState.isSunbathMap)
            {
                _loc_3 = 0;
            }
            var _loc_4:* = Cache.instance.role.roleEntityInfo.weapon;
            var _loc_5:* = Cache.instance.role.roleEntityInfo.hair;
            var _loc_6:* = Cache.instance.role.roleEntityInfo.wing;
            var _loc_7:* = Cache.instance.role.roleEntityInfo.entityInfo.VIP;
            this._roleModelPlayer.updateInfo(_loc_1, _loc_2, _loc_3, _loc_4, _loc_5, _loc_6, _loc_7);
            this._roleModelPlayer.scaleAll = 1.8;
            this._roleModelPlayer.useLight();
            this._roleModelPlayer.rotationX = 0;
            this._roleModelPlayer.rotationY = 0;
            return;
        }// end function

        protected function updateClothWingModel(param1:int) : void
        {
            if (this._roleModelPlayer == null)
            {
                this.initRoleModel();
                this._rect3d.addObject3d(this._roleModelPlayer, 73 + 72 + 14 - 22, 133 + 223 - 60 + 64 + 24);
            }
            if (param1 == EAdvanceComponentType._EAdvanceComponentTypeClothes)
            {
                this._roleModelPlayer.clothes = this._data.tmount.modelId;
                this._roleModelPlayer.wing = 0;
                this._roleModelPlayer.weapon = 0;
                this._roleModelPlayer.loadClothes();
                this._roleModelPlayer.loadWing();
                this._roleModelPlayer.loadWeapon();
            }
            if (param1 == EAdvanceComponentType._EAdvanceComponentTypeWing)
            {
                this._roleModelPlayer.wing = this._data.tmount.modelId;
                this._roleModelPlayer.weapon = 0;
                this._roleModelPlayer.loadClothes();
                this._roleModelPlayer.loadWing();
                this._roleModelPlayer.loadWeapon();
            }
            return;
        }// end function

        protected function updateWeaponModel() : void
        {
            var _loc_3:int = 0;
            var _loc_4:int = 0;
            var _loc_5:int = 0;
            if (this._weaponPlayer == null)
            {
                this._weaponPlayer = FrObjectPool.getObject(WeaponPlayer, this);
                this._weaponPlayer.enabledPool = false;
                this._weaponPlayer.scaleX = 1.8;
                this._weaponPlayer.scaleY = 1.8;
                this._weaponPlayer.scaleZ = 1.8;
                this._weaponPlayer.rotationZ = -20;
                _loc_3 = Cache.instance.role.entityInfo.career;
                switch(_loc_3)
                {
                    case ECareer._ECareerWarrior:
                    {
                        _loc_4 = 132;
                        _loc_5 = 270 + 30;
                        break;
                    }
                    case ECareer._ECareerArcher:
                    {
                        _loc_4 = 132 + 30;
                        _loc_5 = 230 - 25 + 30;
                        break;
                    }
                    case ECareer._ECareerMage:
                    {
                        _loc_4 = 132;
                        _loc_5 = 230 + 30;
                        break;
                    }
                    default:
                    {
                        break;
                    }
                }
                this._rect3d.addObject3d(this._weaponPlayer, _loc_4, _loc_5);
            }
            if (this._roleModelPlayer == null)
            {
                this.initRoleModel();
            }
            var _loc_1:* = this._roleModelPlayer.getModelInfo(ModelType.WEAPONS, this._data.tmount.modelId);
            this._weaponPlayer.load(_loc_1.mesh + ".md5mesh", _loc_1.texture, this._rect3d.renderList);
            this._rect3d.addObject3d(this._weaponPlayer, _loc_4, _loc_5);
            this.stopTurn();
            if (this._frameTimer == null)
            {
                this._frameTimer = new FrameTimer();
                this._frameTimer.addListener(TimerType.ENTERFRAME, this.onTimerFrameHandler);
            }
            this._frameTimer.start();
            this.removeEffect();
            var _loc_2:* = Cache.instance.role.roleEntityInfo.entityInfo.VIP;
            if (_loc_1 && _loc_1.selfEffect && _loc_2 > 0)
            {
                this._weaponEffectPlayer = EffectPlayerPool.instance.getEffectPlayer(_loc_1.selfEffect, this._weaponPlayer, this._rect3d.renderList, true);
                if (this._weaponEffectPlayer.temple is TempleRole)
                {
                    (this._weaponEffectPlayer.temple as TempleRole).setRoleParams(this._weaponPlayer, null, null);
                }
                this._weaponEffectPlayer.play();
            }
            return;
        }// end function

        private function updateFightSoulModel() : void
        {
            var _loc_1:* = ModelConfig.instance.getInfoByCode(this._data.tmount.modelId);
            if (_loc_1)
            {
                if (this._fightSoulModelPlayer == null)
                {
                    this._fightSoulModelPlayer = FrObjectPool.getObject(ActionPlayer, this);
                    this._rect3d.addObject3d(this._fightSoulModelPlayer, 132 + 20 - 14, 280 + 60 + 22);
                }
                this._fightSoulModelPlayer.load(_loc_1.mesh1 + ".md5mesh", _loc_1.bone1 + ".skeleton", _loc_1.texture1, this._rect3d.renderList);
                this._fightSoulModelPlayer.play();
                if (this._data.tmount.type == EFashionType._EFashionFightSoul)
                {
                    this._fightSoulModelPlayer.scaleValue = 10;
                }
                this._fightSoulEffectPlayer = EffectPlayerPool.instance.getEffectPlayer(_loc_1.effect1, null, this._rect3d.renderList, false);
                this._fightSoulEffectPlayer.play(PlayMode.ANIMATION_LOOP_MODE);
                if (this._fightSoulEffectPlayer.temple is TempleRole)
                {
                    TempleRole(this._fightSoulEffectPlayer.temple).setRoleParams(this._fightSoulModelPlayer, null, null);
                }
                else
                {
                    this._fightSoulModelPlayer.addChild(this._fightSoulEffectPlayer);
                }
            }
            return;
        }// end function

        private function onTimerFrameHandler(param1:FrameTimer) : void
        {
            this.modelTurn();
            return;
        }// end function

        private function removeEffect() : void
        {
            if (this._weaponEffectPlayer)
            {
                this._weaponEffectPlayer.dispose();
                this._weaponEffectPlayer = null;
            }
            return;
        }// end function

        private function stopTurn() : void
        {
            if (this._frameTimer)
            {
                this._frameTimer.stop();
            }
            this._turnNum = 0;
            return;
        }// end function

        private function modelTurn() : void
        {
            var _loc_1:* = this._turnNum + 0.1;
            this._turnNum = this._turnNum + 0.1;
            this._weaponPlayer.y = this._weaponPlayer.y + Math.cos(_loc_1) * 1;
            this._weaponPlayer.rotationY = this._weaponPlayer.rotationY + 5;
            return;
        }// end function

        protected function remove3D() : void
        {
            if (this._rect3d)
            {
                if (this._img2d)
                {
                    this._rect3d.removeImg(this._img2d);
                    this._img2d = null;
                }
                if (this._bodyPlayer)
                {
                    this._rect3d.disposeObj3d(this._bodyPlayer);
                    this._bodyPlayer = null;
                }
                if (this._roleModelPlayer)
                {
                    this._rect3d.disposeObj3d(this._roleModelPlayer);
                    this._roleModelPlayer = null;
                }
                if (this._weaponPlayer)
                {
                    this._rect3d.disposeObj3d(this._weaponPlayer);
                    this._weaponPlayer = null;
                }
                if (this._weaponEffectPlayer)
                {
                    this._rect3d.disposeObj3d(this._weaponEffectPlayer);
                    this._weaponEffectPlayer = null;
                }
                if (this._fightSoulModelPlayer)
                {
                    this._rect3d.disposeObj3d(this._fightSoulModelPlayer);
                    this._fightSoulModelPlayer = null;
                }
                if (this._fightSoulEffectPlayer)
                {
                    this._rect3d.disposeObj3d(this._fightSoulEffectPlayer);
                    this._fightSoulEffectPlayer = null;
                }
                Rect3DManager.instance.disposeRect3d(this._rect3d);
                this._rect3d = null;
            }
            return;
        }// end function

        public function set data(param1:ChargeActivityData) : void
        {
            this._data = param1;
            if (this._data)
            {
                this.updateAll();
            }
            return;
        }// end function

        private function updateAll() : void
        {
            var _loc_1:DataProvider = null;
            var _loc_2:Array = null;
            var _loc_3:ItemData = null;
            this.clear();
            this._bg.imgUrl = "ChargeActivityBg_" + this._data.tmount.code;
            this._levelNum.imgUrl = this._data.tmount.code == 3 ? (ImagesConst.SystemLevel_3) : (ImagesConst.SystemLevel_4);
            this._levelName.text = this._data.tmount.name;
            this._leftTime.setLeftTime(ClockManager.instance.todayLeftMillisecond * 0.001);
            if (this._data.activityType == ChargeActivityData.ActivityType_Four)
            {
                _loc_1 = new DataProvider();
                _loc_2 = this.getRechargeRebateItems();
                _loc_1.addItems(_loc_2);
                this._itemList.dataProvider = _loc_1;
                this._itemList.drawNow();
                this._gotoChargeBtn.visible = true;
            }
            else if (this._data.activityType == ChargeActivityData.ActivityType_Three)
            {
                this._propItem.visible = true;
                _loc_3 = new ItemData(int(this._data.tmount.returnAdvanceNum.split("#")[0]));
                this._propItem.itemData = _loc_3;
                this._chargeLittleBtn.visible = true;
            }
            return;
        }// end function

        private function getRechargeRebateItems() : Array
        {
            var _loc_6:String = null;
            var _loc_7:Array = null;
            var _loc_8:ItemData = null;
            var _loc_9:int = 0;
            var _loc_10:String = null;
            var _loc_11:Array = null;
            var _loc_1:* = RebateUtil.getDayRechargeList();
            var _loc_2:Array = [];
            if (_loc_1 == null || _loc_1.length == 0)
            {
                return null;
            }
            var _loc_3:* = _loc_1[0];
            var _loc_4:* = _loc_3.giftBag;
            var _loc_5:* = ItemConfig.instance.getConfig(_loc_4) as ItemGiftBagInfo;
            if (_loc_5)
            {
                _loc_6 = _loc_5.itemList1;
                _loc_7 = _loc_6.split("&");
                _loc_9 = 0;
                while (_loc_9 < _loc_7.length)
                {
                    
                    _loc_10 = _loc_7[_loc_9];
                    _loc_11 = _loc_10.split("#");
                    if (_loc_11.length == 3)
                    {
                        _loc_8 = new ItemData(int(_loc_11[1]));
                        _loc_8.itemAmount = int(_loc_11[2]);
                    }
                    else
                    {
                        _loc_8 = new ItemData(int(_loc_11[0]));
                        _loc_8.itemAmount = int(_loc_11[1]);
                    }
                    _loc_2.push(_loc_8);
                    _loc_9++;
                }
            }
            return _loc_2;
        }// end function

        private function onTimeOutHandler() : void
        {
            return;
        }// end function

        private function addModel() : void
        {
            this.initModel();
            return;
        }// end function

        private function removeModel() : void
        {
            if (this._bodyPlayer)
            {
                this._rect3d.disposeObj3d(this._bodyPlayer);
                this._bodyPlayer = null;
            }
            if (this._roleModelPlayer)
            {
                this._rect3d.disposeObj3d(this._roleModelPlayer);
                this._roleModelPlayer = null;
            }
            if (this._weaponPlayer)
            {
                this._rect3d.disposeObj3d(this._weaponPlayer);
                this._weaponPlayer = null;
            }
            if (this._frameTimer)
            {
                this._frameTimer.dispose();
                this._frameTimer = null;
            }
            if (this._weaponEffectPlayer)
            {
                this._rect3d.disposeObj3d(this._weaponEffectPlayer);
                this._weaponEffectPlayer = null;
            }
            if (this._fightSoulModelPlayer)
            {
                this._rect3d.disposeObj3d(this._fightSoulModelPlayer);
                this._fightSoulModelPlayer = null;
            }
            if (this._fightSoulEffectPlayer)
            {
                this._rect3d.disposeObj3d(this._fightSoulEffectPlayer);
                this._fightSoulEffectPlayer = null;
            }
            return;
        }// end function

        private function onClickHandler(event:MouseEvent) : void
        {
            var _loc_2:int = 0;
            if (this._data.activityType == ChargeActivityData.ActivityType_Four)
            {
                _loc_2 = ModuleTypeConst.RebateRecharge;
            }
            else if (this._data.activityType == ChargeActivityData.ActivityType_Three)
            {
                _loc_2 = ModuleTypeConst.FirstRecharge;
            }
            GameUtil.gotoRecharge(_loc_2);
            return;
        }// end function

        private function clear() : void
        {
            this._levelName.text = "";
            this._levelNum.imgUrl = "";
            this._itemList.dataProvider = new DataProvider();
            this._itemList.drawNow();
            this._propItem.itemData = null;
            this._propItem.visible = false;
            this._gotoChargeBtn.visible = false;
            this._chargeLittleBtn.visible = false;
            this.removeModel();
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._bg.dispose();
            this._bg = null;
            this._levelNum.dispose();
            this._levelNum = null;
            this._levelName.dispose();
            this._levelName = null;
            this._itemList.dispose();
            this._itemList = null;
            this._gotoChargeBtn.dispose();
            this._gotoChargeBtn = null;
            this._propItem.dispose();
            this._propItem = null;
            this._chargeLittleBtn.dispose();
            this._chargeLittleBtn = null;
            this._leftTime.dispose();
            this._leftTime = null;
            if (this._frameTimer)
            {
                this._frameTimer.dispose();
                this._frameTimer = null;
            }
            this._data = null;
            this.remove3D();
            super.disposeImpl();
            return;
        }// end function

        override protected function onWindowDownHandler(event:MouseEvent) : void
        {
            return;
        }// end function

        public static function get instance() : ChargeActivityWin
        {
            if (_instance == null)
            {
                _instance = new ChargeActivityWin;
            }
            return _instance;
        }// end function

        public static function get isViewShow() : Boolean
        {
            return _instance && !_instance.isHide;
        }// end function

    }
}
